package com.rightsidetech.trade.mapper;

import com.rightsidetech.trade.dtos.request.TdCommodityAgentAppRequest;
import com.rightsidetech.trade.dtos.request.TdCommodityBillReq;
import com.rightsidetech.trade.dtos.request.TdCommodityOrderListRequest;
import com.rightsidetech.trade.dtos.request.TdCommodityStoreAppListRequest;
import com.rightsidetech.trade.dtos.response.*;
import com.rightsidetech.trade.entity.TdCommodityUserOrder;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface TdCommodityUserOrderMapper {
    int deleteByPrimaryKey(Long id);

    int insert(TdCommodityUserOrder record);

    int insertSelective(TdCommodityUserOrder record);

    TdCommodityUserOrder selectByPrimaryKey(Long id);

    TdCommodityUserOrder selectByOtherPaltformsOrderNo(@Param("otherPaltformsOrderNo") String otherPaltformsOrderNo);

    int updateByPrimaryKeySelective(TdCommodityUserOrder record);

    int updateByPrimaryKey(TdCommodityUserOrder record);

    List<TdCommodityUserOrderResp> list(TdCommodityOrderListRequest request);

    Long list_COUNT(TdCommodityOrderListRequest request);

    List<TdCommodityUserOrderAgentResp> listAgent(TdCommodityOrderListRequest request);

    Long listAgent_COUNT(TdCommodityOrderListRequest request);

    List<TdCommodityBillResp> listBill(TdCommodityBillReq req);

    List<TdCommodityBillAgentResp> listBillAgent(TdCommodityBillReq req);

    TdCommodityUserOrder selectByOrderNo(@Param("orderNo") String orderNo);

    TdCommodityDetailResp selectByOrderIdOrAgentId(@Param("id") Long id, @Param("agentId") Long agentId);

    int updateOrderStatusByOrderNoAndTime(@Param("orderNo") String orderNo);

    List<TdCommodityAppOrderListResp> selectAppList(@Param("orderStatus") String orderStatus, @Param("userInfoId") Long userInfoId);

    Long selectAppList_COUNT(@Param("orderStatus") String orderStatus, @Param("userInfoId") Long userInfoId);

    TdCommodityAppOrderAfterServiceResp selectUsOderByOrderNo(@Param("orderNo") String orderNo, @Param("userInfoId") Long userInfoId);

    List<TdCommodityStoreAppListResp> selectStoreAppList(TdCommodityStoreAppListRequest req);

    Long selectStoreAppList_COUNT(TdCommodityStoreAppListRequest req);

    int updateOrderStatusByOrderNo(@Param("orderNo") String orderNo, @Param("orderStatus") Byte orderStatus, @Param("updateAt") Date updateAt);

    TdCommodityStoreOrderDetailResp selectStoreDetailByOrderNo(@Param("orderNo") String orderNo, @Param("storeId") Long storeId, @Param("agentId") Long agentId);


    List<TdCommodityStoreAppListResp> selectAgentAppList(TdCommodityAgentAppRequest req);

    Long selectAgentAppList_COUNT(TdCommodityAgentAppRequest req);

    TdCommodityAgentAppResp selectStatisByAgentId(@Param("agentId") Long agentId, @Param("storeId") Long storeId);

    Long selectFinishTotalOrderNumByStoreId(Long storeId);

    Long selectFinishTodayOrderNumByStoreId(Long storeId);

    Long findOrderNumById(@Param("areaId") Long areaId,@Param("agentId") Long agentId, @Param("isYesterday") Byte isYesterday);

    List<HomeMonthOrderResp> findMonthOrder(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("areaId") Long areaId);

    List<HomeMonthOrderResp> findThisMonthOrderByAgentId(@Param("agentInfoId") Long agentInfoId);

    TdCommodityUserOrderZpResp selectZPMsgByOrderNo(@Param("orderNo") String orderNo);

    TdStatisIncomeRefundResp selectIncomeRefund(@Param("statisTime") String statisTime, @Param("storeId") Long storeId, @Param("source") String source,@Param("orderStatus") Byte orderStatus);

    TdStatisIncomeRefundResp selectOnlyIncome(@Param("statisTime") String statisTime, @Param("storeId") Long storeId, @Param("source") String source);

    TdUserOrderInfoResp selectOrderById(Long id);

    Long selectStatisSalesVolumeOrderCount(@Param("statisTime") String statisTime, @Param("storeId") Long storeId, @Param("source") String source);

    Long selectStatisRefundOrderCount(@Param("statisTime") String statisTime, @Param("storeId") Long storeId, @Param("source") String source);

    List<Long> selectStoreIdsByStatisTime(@Param("statisTime") String statisTime);
}